package com.example.demo5datajpa.web;

import com.example.demo5datajpa.domain.Dept;
import com.example.demo5datajpa.domain.DeptRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author : zhuyanpeng.zhuyanpeng
 * @Description: :
 * @date :Create in  2019/6/18- 23:12
 * @Version: V1.0
 * @Modified By:
 **/
@RestController
@RequestMapping("/dept")
public class DeptController {

    @Autowired
    DeptRepository deptRepository;

    @GetMapping("/{id}")
    public Dept getDept(@PathVariable("id") Integer id){
        Dept dept = deptRepository.findById(id).get();
        return dept;
    }

}
